package solitaire.deck;

import java.awt.Point;
import java.util.*;

public class CardCollection extends ArrayList<Card> {

	// Set the location for all the cards in this collection
	public void setLocation(double dX, double dY)
	{
		int i = 0;
		for(Card c : this)
		{
			i++;
			c.setLocation(dX, dY+(i*30));
		}
	}
	
	public void storeLocation()
	{
		for(Card c : this)
		{
			c.storeLocation();
		}
	}
	
	public void restoreLocation()
	{
		for(Card c : this)
		{
			c.restoreLocation();
		}
	}
		
	// Get the first card in the collection 
	public Card getFirst()
	{
		Card c;
		if (this.size() !=0)
		{
			return c = this.get(0);
		}
		return null;
	}
	
	// Get the last card in the collection
	public Card getLast()
	{
		Card c;
		if (this.size() != 0)
		{
		c = this.get(this.size()-1);
		return c;
		}
		return null;
	}
}
